﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sobiens.Connectors.Entities.Search;

namespace Sobiens.Connectors.Entities
{
    public class CamlFilters:List<CamlFilter>
    {
        public bool IsOr = false;
        public CamlFilters() { }
        public CamlFilters(SearchFilters searchFilters)
        {
            this.IsOr = searchFilters.IsOr;
            foreach (SearchFilter searchFilter in searchFilters)
            {
                CamlFilter filter = new CamlFilter(searchFilter);
                this.Add(filter);
            }
        }
        public string GetCombinationFilterTypeString()
        {
            if (this.IsOr == true)
                return "Or";
            else
                return "And";
        }
        public CamlFilters Clone()
        {
            CamlFilters filters = new CamlFilters();
            foreach (CamlFilter filter in this)
            {
                filters.Add(filter);
            }
            return filters;
        }
    }
}
